package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Weibo;
import cn.tedu._04mybatis.pojo.vo.WeiboVO1;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface WeiboMapper {
    @Insert("insert into weibo(content,created,user_id)" +
            "values ( #{content},#{created},#{userId})")
    void insertWeibo(Weibo weibo);

    //@Delete("DELETE FROM weibo WHERE id=#{wid}")
    int deleteByWeiboId(Long wid);

    @Update("UPDATE weibo SET content=#{content},created=#{created},user_id=#{userId} WHERE id=#{id}")
    int updateWeiboById(Weibo weibo);

    //@Select("select content,created,user_id from weibo where id=#{wid}")
    WeiboVO1 selectWeiboById(Long wid);

    //@Select("SELECT id,content,created,user_id userId FROM weibo")
    List<Weibo> selectWeiboAll();

    @Select("SELECT content,user_id userId FROM weibo WHERE id = #{wid}")
    WeiboVO1 selectWeiboById1(Long wid);

    int dynamicUpdate(Weibo weibo);

    int dynamicDelete1(Long[] ids);

    int dynamicDelete2(List<Long> ids);


}
